<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title id="title"></title>
    <link rel="stylesheet" href="./style/weui.css"/>
    <link rel="stylesheet" href="./example.css"/>
    <link rel="stylesheet" href="./style/TimeCircles.css"/>
    <link rel="stylesheet" href=""/>
</head>
<body ontouchstart>
    <div class="container js_container"  id="content">

    </div>
    <!-- zepto.js was cached by wechat app -->
    <!--<script src="https://res.wx.qq.com/open/libs/zepto/1.1.6/zepto.js"></script>-->
  <!--  <script type="text/javascript" src="./js/comm.js"></script>-->
    <script src="./js/wx.js?v=$RELEASE_VERSION$"></script>
    <script src="./js/sea.js?v=$RELEASE_VERSION$"></script>
    <script src="./js/init.js?v=$RELEASE_VERSION$"></script>

    <!--errormsg -->
    <div class="weui_toptips weui_warn js_tooltips" onclick="javascript:$spa.hideErrorMsg()">格式不对</div>

    <div id="timeDiv">
        <div id="someTimer1" class="someTimer" data-date="2015-10-01 00:00:00" style="width: 90%; margin: 0 auto;"></div>
    </div>
    <!--loading -->
    <div id="loadingToast" class="weui_loading_toast" style="display:none;">
        <div class="weui_mask_transparent"></div>
        <div class="weui_toast">
            <div class="weui_loading">
                <div class="weui_loading_leaf weui_loading_leaf_0"></div>
                <div class="weui_loading_leaf weui_loading_leaf_1"></div>
                <div class="weui_loading_leaf weui_loading_leaf_2"></div>
                <div class="weui_loading_leaf weui_loading_leaf_3"></div>
                <div class="weui_loading_leaf weui_loading_leaf_4"></div>
                <div class="weui_loading_leaf weui_loading_leaf_5"></div>
                <div class="weui_loading_leaf weui_loading_leaf_6"></div>
                <div class="weui_loading_leaf weui_loading_leaf_7"></div>
                <div class="weui_loading_leaf weui_loading_leaf_8"></div>
                <div class="weui_loading_leaf weui_loading_leaf_9"></div>
                <div class="weui_loading_leaf weui_loading_leaf_10"></div>
                <div class="weui_loading_leaf weui_loading_leaf_11"></div>
            </div>
            <p class="weui_toast_content"></p>
        </div>
    </div>


<!-- success-->
    <div id="toast" style="display: none;">
        <div class="weui_mask_transparent"></div>
        <div class="weui_toast">
            <i class="weui_icon_toast"></i>
            <p class="weui_toast_content"></p>
        </div>
    </div>


    <!--BEGIN dialog1-->
    <div class="weui_dialog_confirm" id="dialog1" style="display: none;">
        <div class="weui_mask"></div>
        <div class="weui_dialog">
            <div class="weui_dialog_hd"><strong class="weui_dialog_title" id="d_title">弹窗标题</strong></div>
            <div class="weui_dialog_bd" id="d_content">自定义弹窗内容<br>...</div>
            <div class="weui_dialog_ft">
                <a href="javascript:;" class="btn_weui_dialog default" id="d_cancle">取消</a>
                <a href="javascript:;" class="btn_weui_dialog primary" id="d_submit">确定</a>
            </div>
        </div>
    </div>
    <!--END dialog1-->
    <!--BEGIN dialog2-->
    <div class="weui_dialog_alert" id="dialog2" style="display: none;">
        <div class="weui_mask"></div>
        <div class="weui_dialog">
            <div class="weui_dialog_hd"><strong class="weui_dialog_title">弹窗标题</strong></div>
            <div class="weui_dialog_bd">弹窗内容，告知当前页面信息等</div>
            <div class="weui_dialog_ft">
                <a href="javascript:;" class="btn_weui_dialog primary">确定</a>
            </div>
        </div>
    </div>
    <!--END dialog2-->


    <!--BEGIN dialog3-->
    <div class="weui_dialog_confirm" id="dialog3" style="display: none;">
        <div class="weui_mask"></div>
        <div class="weui_dialog">
            <div class="weui_dialog_hd"><strong class="weui_dialog_title">弹窗标题</strong></div>
            <div class="weui_dialog_bd"><input class="weui_input" type="text" placeholder="请输入qq号"/></div>
            <div class="weui_dialog_ft">
                <a href="javascript:;" class="btn_weui_dialog default">取消</a>
                <a href="javascript:;" class="btn_weui_dialog primary">确定</a>
            </div>
        </div>
    </div>
    <!--END dialog3-->

    <style>
        #CouponList label { background: url(images/coupon-bg.jpg); background-size: auto 100%; overflow: hidden; padding: 4% 0 3% 5%; }
        #CouponList .yuan { height: 79%; right: 0; top: 10%; line-height: 500%; padding: 0 5%; }
        #CouponList div.abs {
            right: 3%;
            border-radius: 20px;
            border: 1px solid #464646;
            height: 20px;
            width: 20px;
            top: 22%;
            text-align: center;
        }

        #CouponList div.abs span {
            display: none;
        }

        #payMethod {
            border-bottom: 1px solid #e5e5e5;
        }

        #payMethod li {
            display: inline-block;
            width: 48%;
            text-align: center;
            padding: 3% 0;
            color: #bebebe;
        }

        #payMethod li.on {
            color: #282828;
        }

        #payMethod li.on span:before {
            content: "";
            display: inline-block;
            height: 0;
            width: 0;
            border: 4px solid #93cb1f;
            border-radius: 5px;
            margin-right: 8px;
        }
    </style>

    <script>
      // localStorage.clear()
        var deps = ['$', 'spa', 'json-api'];
        app.use(deps, function ($,  spa, jsonAPI) {
            var $ = window.Zepto;
            $.extend(app, {
                noSessionHandler: function () {
                    window.hashTo('#login');
                },
                jsonAPIErrorHandler: function (msg) {
                  $spa.showErrorMsg(msg);
                }
            });

            spa.launch({
                spaDashboard: {        //参考: spa-dashboard-interface.js接口, 这里应该是它的一个实现类的实例
                    getVersion: function () {
                        return '0.1';
                    },
                    setTitle: function (title) {
                    },
                    showErrorMsg:function(msg)
                    {
                        $('.js_tooltips').html(msg);
                        $('.js_tooltips').show();
                        setTimeout(function (){
                            $('.js_tooltips').hide();
                        }, 2000);
                    },
                    hideErrorMsg:function()
                    {
                        $('.js_tooltips').hide();
                    },
                    showLoading:function(msg)
                    {
                        msg=msg||'正在加载数据';
                        $('#loadingToast').find('p').html(msg);
                        $('#loadingToast').show();
                    },
                    hideLoading:function()
                    {
                        $('#loadingToast').find('p').html('');
                        $('#loadingToast').hide();
                    },
                    showOk:function(msg)
                    {
                        msg=msg||'已完成';
                        $('#toast').find('p').html(msg);
                        $('#toast').show();
                    },
                    hideOk:function()
                    {
                        $('#toast').find('p').html('');
                        $('#toast').hide();
                    },
                    confirm:function(title,content,ok,cacle)
                    {
                        title=title||'标题';
                        content=content||'';
                        ok=ok||function() {$("#dialog1").hide();}
                        cacle=cacle||function() {$("#dialog1").hide();}
                        $("#dialog1").find('#d_title').html(title);
                        $("#dialog1").find('#d_content').html(content);
                        $("#dialog1").find('#d_cancle').on('click',cacle);
                        $("#dialog1").find('#d_submit').on('click',function()
                        {
                            $("#dialog1").hide();
                            ok&&ok();
                        });
                        $("#dialog1").show();
                    },
                    createTimer:function(startTime,selector)
                    {
                        $('#someTimer1').data('date',startTime);
                     //   alert('ok');
                     //   alert($('#someTimer1').attr("data-date"));
                        window.timeXX=$('#someTimer1').TimeCircles({
                            time : {
                                Days: {
                                    show: false,
                                    text: "天",
                                    color: "#FC6"
                                },
                                Hours: {
                                    show: false,
                                    text: "时",
                                    color: "#9CF"
                                },
                                Minutes: {
                                    show: false,
                                    text: "分",
                                    color: "#BFB"
                                },
                                Seconds: {
                                    show: false,
                                    text: "秒",
                                    color: "#F99"
                                }
                            }
                        });
                        $(selector).append($('#someTimer1'));
                    },
                    destoryTimer:function()
                    {
                        window.timeXX.destroy();
                        $("#timeDiv").html('<div id="someTimer1" class="someTimer" data-date="2015-10-01 00:00:00" style="width: 90%; margin: 0 auto;"></div>');
                    },
                    configJSSDK:function()
                    {
                        //配置js sdk
                        jsonAPI.restful('/api/getJsConfig', {url: location.href.split('#')[0]}, function (err, result) {
                            if (jsonAPI.handleErrors(err, result)) {
                                r=result.result;
                                wx.config({
                                            debug: true,
                                            appId: r.appId,
                                            timestamp: r.timestamp,
                                            nonceStr: r.nonceStr,
                                            signature: r.signature,
                                            jsApiList: r.jsApiList
                                        }
                                );
                            }
                        });
                    }
                },
                widgetHome: './widgets',
                container: '#content',
                routes: {
                },
                routesEx: [    //外部routes脚本, 支持与外部插件的SPA式集成
                ],
             //   mode:'production',
                whiteList:[

                ],
                beforeLoad: function (hash, widgetURL) {
                    //osop widget加载前触发，一般显示一个"加载中"遮罩
                    $("#content").hide();
                    $spa.showLoading();
                },
                afterLoad: function (hash, widgetURL, flag) {
                    //osop widget加载完成后触发，一般隐藏遮罩显示面页
                    $spa.hideLoading();
                    $("#content").show();
                },
                ignoreInitLoad: false
            });




            //window.hashTo('#login',{"mobile":'123456'}); //test register forword

        /*    basic.loadSession(function (user) {
                window.$user = user;
                $('.user-name').text('欢迎您,'+user.name);
                //    $('.user-name').text('欢迎您,管理员');
            }, app.noSessionHandler);*/




                });
    </script>
</body>
</html>